package com.spboot.redis.config;

import org.springframework.cglib.core.Predicate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.server.RequestPath;
import org.springframework.web.bind.annotation.RequestMapping;

import springfox.documentation.RequestHandler;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@EnableSwagger2 //开启
@Configuration //配置类
public class SwaggerConfig {

	@Bean
	public Docket docket(){
		
		
		Docket docket = new Docket(DocumentationType.SWAGGER_2);
		
		//接口地址、包、规则
		docket
			.pathMapping("/")
			.select()
			.apis(RequestHandlerSelectors.basePackage("com.spboot.redis.contoller"))
			.paths(PathSelectors.any())
			.build();
		
		//作者 联系方式 项目地址 ...
		ApiInfo apiInfo =new ApiInfoBuilder()
			.title("SpringBoot Redis 操作API地址")
			.description("可以使用api对redis数据类型进行增删改查")
			.version("1.0")
			.build();
		
		docket.apiInfo(apiInfo);
		return docket;
	}
}
